///PHILOTES Source Code.  (C)2012 PhiloLabs
#pragma once

#ifndef _ArchiveManager_H__
#define _ArchiveManager_H__

#include "OgrePrerequisites.h"

#include "OgreResourceManager.h"
#include "OgreSingleton.h"

namespace Ogre {

	
	
    
    class _OgreExport ArchiveManager : public Singleton<ArchiveManager>, public MemAlloc_General
    {
    protected:
        typedef map<String, ArchiveFactory*>::type ArchiveFactoryMap;
        /// Factories available to create archives, indexed by archive type (String identifier e.g. 'Zip')
        ArchiveFactoryMap mArchFactories;
        /// Currently loaded archives
        typedef map<String, Archive*>::type ArchiveMap;
        ArchiveMap mArchives;

    public:
        
        ArchiveManager();
        
        virtual ~ArchiveManager();

        
        Archive* load( const String& filename, const String& archiveType);

		
		void unload(Archive* arch);
		
		void unload(const String& filename);
		typedef MapIterator<ArchiveMap> ArchiveMapIterator;
		
		ArchiveMapIterator getArchiveIterator(void);

        
        void addArchiveFactory(ArchiveFactory* factory);
        
        static ArchiveManager& getSingleton(void);
        
        static ArchiveManager* getSingletonPtr(void);
    };
	
	

}

#endif
